/* --------------------------------------------------------------------------
 *  CppADCodeGen: C++ Algorithmic Differentiation with Source Code Generation:
 *    Copyright (C) 2016 Ciengis
 *
 *  CppADCodeGen is distributed under multiple licenses:
 *
 *   - Eclipse Public License Version 1.0 (EPL1), and
 *   - GNU General Public License Version 3 (GPL3).
 *
 *  EPL1 terms and conditions can be found in the file "epl-v10.txt", while
 *  terms and conditions for the GPL3 can be found in the file "gpl3.txt".
 * ----------------------------------------------------------------------------
 * Author: Joao Leal
 */
#include "../CppADCGEvaluatorTest.hpp"

using namespace CppAD;
using namespace CppAD::cg;

TEST_F(CppADCGEvaluatorTest, SolveAdd) {
    OperationNodeNameStreambuf<double> b;
    std::ostream out(&b);

    CG<double> v;
    out << "before" << v << "after";
    ASSERT_TRUE(v.isParameter());

    CodeHandler<double> h;
    CG<double> v2;
    h.makeVariable(v2);


    out << "before" << v2 << "myName";
    ASSERT_TRUE(v2.isVariable());
    ASSERT_TRUE(v2.getOperationNode()->getName() != nullptr);
    ASSERT_TRUE(*v2.getOperationNode()->getName() == "myName");
}
